import 'package:flutter/services.dart';


//调用原生方法
class NativeChannel {


  static Future requestReview() async {
    const platform = MethodChannel('gm_app_channel');
    try {
      var result = await platform.invokeMethod('requestReview');
      return Future.value(result);
    } on PlatformException catch (e) {
      return Future.error(e.toString());
    }
  }

  static Future gotoStoreReview() async {
    const platform = MethodChannel('gm_app_channel');
    try {
      var result = await platform.invokeMethod('gotoStoreReview');
      return Future.value(result);
    } on PlatformException catch (e) {
      return Future.error(e.toString());
    }
  }

  static Future shareApp(String url, String content) async {
    const platform = MethodChannel('gm_app_channel');
    try {
      var result = await platform.invokeMethod('shareApp', {'url': url, 'content': content});
      return Future.value(result);
    } on PlatformException catch (e) {
      return Future.error(e.toString());
    }
  }


}
